package study.tabledriven;

public class MonthDay {
    private int[][] monthDay = {
            {1,31},
            {2,28},
            {3,31},
            {4,30},
            {5,31},
            {6,30},
            {7,31},
            {8,31},
            {9,30},
            {10,31},
            {11,30},
            {12,31}
    };

    public int[][] getMonthDay() {
        return monthDay;
    }

    public void setMonthDay(int[][] monthDay) {
        this.monthDay = monthDay;
    }

    public static void main(String[] args) {
        MonthDay monthDay = new MonthDay();
        int year = 2100;
        int month = 2;
        int[] md = monthDay.getMonthDay()[month-1];
        System.out.println(monthDay.isLeapYear(year)?md[1]+1:md[1]);

    }

    private boolean isLeapYear(int year) {
        if(year  % 100 == 0){
            return year % 400 == 0;
        }
        return year%4 ==0;
    }
}
